<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .container {
        width: 800px;
        height: 400px;
      }
    </style>
  </head>
  <body>
    <div class="container"></div>
    <script src="./echarts.js"></script>
    <script>
      const myEcharts = echarts.init(document.querySelector(".container"));

      function getRandom(len) {
        const arr = [];
        for (var i = 0; i < len; i++) {
          arr.push(Math.round(Math.random() * 100 + 50));
        }
        return arr;
      }

      const option = {
        xAxis: {
          data: [
            "January",
            "February",
            "March",
            "April",
            "May",
            "June",
            "July",
            "August",
            "September",
            "October",
            "November",
            "December",
          ],
        },
        yAxis: {},
        series: [
          {
            type: "bar",
            data: getRandom(12),
          },
          {
            type: "line",
            data: getRandom(12),
          },
          {
            type: "pie",
            data: [
              { name: "老王一", value: 2 },
              { name: "老王二", value: 22 },
              { name: "老王三", value: 222 },
            ],
            radius: [0, 50],
            center: [600, 60],
          },
        ],
      };

      myEcharts.setOption(option);
    </script>
  </body>
</html>
